< previous page page_597 next page >

Page 597
9f31265bb40b592b1929e18a47ab28e5.gif
              txtKeyName, _
              txtKeyValue
End Sub
DeleteSetting
You can delete a single key value using the DeleteSetting statement. Look at the code in the DeleteSetting command button to see the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdDeleteSetting_Click()
   DeleteSetting txtConfig, _
                txtSection, _
                txtKeyName
End Sub
GetAllSettings
You can retrieve all the settings in a particular section using the GetAllSettings() function. This function returns a Variant array if any values are returned. Look in the GetAllSettings command button to see the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdGetAllSettings_Click()
   Dim astrKeys As Variant
   Dim intLoop As Integer

   astrKeys = GetAllSettings(txtConfig, _
                           txtSection)
   lstKeys.Clear
   If Not IsEmpty(astrKeys) Then
      For intLoop = LBound(astrKeys) To UBound(astrKeys)
         lstKeys.AddItem astrKeys(intLoop, 0) & _
                        "=" & astrKeys(intLoop, 1)
      Next
   End If
End Sub
In the Click event of this command button, the GetAllSettings() function is called. It returns a Variant array to the astrKeys variable. This function checks to see whether the array is empty. If its not empty, the function loops from the lower bound of the array to the upper bound. Each time through the loop, it retrieves the key name from element 0 of this two-dimensional array and the key value from element 1 of this array.

 
< previous page page_597 next page >

If you like this book, buy it!